Skip to content

feat(cli): add image update command for metadata and tags#483

Open
digaobarbosa wants to merge 5 commits into
mainfrom
digao/cli-image-metadata-update
Open

feat(cli): add image update command for metadata and tags#483
digaobarbosa wants to merge 5 commits into
mainfrom
digao/cli-image-metadata-update

Conversation

@digaobarbosa
Copy link
Copy Markdown
Contributor

@digaobarbosa digaobarbosa commented May 20, 2026

Description

Adds CLI support for updating metadata and tags on existing images using the new workspace-level API endpoints (roboflow/roboflow#11836).

Changes:

  • New roboflow image metadata command — single-image sync or multi-image batch (async with polling)
  • roboflow image tag kept as a hidden alias pointing to the same handler (zero duplication)
  • Two new rfapi adapter functions: update_image_metadata (sync) and batch_update_image_metadata (async)

Type of change

  • New feature

How has this change been tested?

  • 113 unit tests pass (16 new tests covering adapter + CLI handler)
  • ruff lint and mypy pass
  • CLI help verified for both image metadata and image tag

Usage examples

# Single image: set metadata + add tags
roboflow image metadata <image_id> -m '{"camera": "cam1"}' --tags "review,v2"

# Remove metadata keys
roboflow image metadata <image_id> --remove-metadata "old_key"

# Batch: update multiple images, poll for completion
roboflow image metadata img1,img2,img3 --tags "processed" --poll

# Tag alias works identically
roboflow image tag <image_id> --tags "review" --remove-tags "draft"

Notes on review feedback

--poll and roboflow.core.async_tasks

A review flagged from roboflow.core.async_tasks import poll_until_terminal (in _handle_metadata_batch) as importing a non-existent module. That module does exist on this branch — it was added by PR #473 (Add Universe project fork CLI) and provides the shared poll_until_terminal polling utility (roboflow/core/async_tasks.py). The --poll path imports and runs correctly; this CLI is reusing the same polling helper instead of re-implementing it inline.

Breaking change in roboflow image tag flags

The hidden roboflow image tag alias drops the legacy --add / --remove / --project flags in favor of --tags / --remove-tags (no --project, because the new endpoint is workspace-scoped). Production traffic to the old per-tag REST endpoints (POST/DELETE /{workspace}/{project}/images/{id}/tags/{tag}) over the last 30 days:

Last 30 days logs:
https://cloudlogging.app.goo.gl/RRbwBKYW7cSvNHDQ6

Last 30 days from bigquery:
bigquery

Since the only matches are an internal probe in a non-customer workspace, the breaking flag change on the hidden alias does not affect real users.

Will the change affect Universe?

No

Any specific deployment considerations

N/A — SDK-only change

Docs

  • Docs updated? CLI-COMMANDS.md update needed (tracked separately)

digaobarbosa and others added 3 commits May 20, 2026 16:10
… new metadata endpoint

Adds support for the new workspace-level image metadata/tags API:
- `roboflow image update` for updating metadata and tags on existing images (single sync + batch async)
- Refactors `roboflow image tag` to use the new endpoint, removing the now-unnecessary `--project` flag

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… hidden alias

Both `roboflow image metadata` and `roboflow image tag` now point to the
same handler with identical flags (--tags, --remove-tags, --metadata,
--remove-metadata, --poll, --timeout). Zero code duplication.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@digaobarbosa digaobarbosa self-assigned this May 21, 2026
@digaobarbosa digaobarbosa requested a review from a team May 21, 2026 20:15
@digaobarbosa digaobarbosa marked this pull request as ready for review May 21, 2026 20:15
Copy link
Copy Markdown
Collaborator

@tonylampada tonylampada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants